const mongoose = require('mongoose');

mongoose.connect('mongodb://localhost:27017/class-020',    
    {   // 兼容旧方法
        useNewUrlParser: true 
    },(err)=>{
        if(err){
            console.log('链接mongo错误',err);
            return;
        }
        console.log('链接mongo成功');
    }
)
// 用户 字段
let userShema = new mongoose.Schema({
    account     : String,
    password    : String,
    header      : {
        default : '/xxx/yyy.png',
        type    : String
    }
})

// 输出model
module.exports.User = mongoose.model('user',userShema);